Skip to content

Conversation

@BIPLAVGHOSAL
Copy link
Owner

This pull request introduces several enhancements to the activity management system, including the addition of new activities, validation for duplicate sign-ups, and UI improvements to display participant details. Below are the key changes grouped by theme:

Backend Enhancements:

  • Added six new activities (Soccer Team, Basketball Team, Art Club, Drama Club, Math Club, and Debate Team) to the activities dictionary, each with a description, schedule, maximum participants, and initial participants. (src/app.py, src/app.pyR41-R76)
  • Implemented a validation step in the signup_for_activity function to prevent duplicate sign-ups by checking if the user is already in the participants list. If so, an HTTPException with a 400 status code is raised. (src/app.py, src/app.pyR101-R104)

Frontend Enhancements:

  • Updated the activity card in the frontend to display a list of participants for each activity. This includes rendering participant emails in an unordered list under a new Participants section. (src/static/app.js, src/static/app.jsR28-R33)

Styling Improvements:

  • Added CSS styles for the new Participants section, including a styled container with a light blue background, rounded borders, and customized text colors for better readability. (src/static/styles.css, src/static/styles.cssR145-R169)

@BIPLAVGHOSAL BIPLAVGHOSAL requested a review from Copilot May 10, 2025 09:35
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the activity management system by adding new activities, preventing duplicate sign-ups, and improving the UI for displaying participants.

  • Added six new activities with relevant details in the backend
  • Implemented duplicate sign-up validation in the signup function
  • Updated the frontend and CSS for better presentation of participant details

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/app.py Added new activities and duplicate sign-up validation logic
src/static/app.js Updated activity card to display a list of participant emails
src/static/styles.css Added CSS styles for the new Participants section

Comment on lines +101 to 107
# Validate student is not already signed up
if email in activity["participants"]:
raise HTTPException(status_code=400, detail="Already signed up for this activity")

# Add student
activity["participants"].append(email)
return {"message": f"Signed up {email} for {activity_name}"}
Copy link

Copilot AI May 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider normalizing email addresses (e.g., converting them to lowercase) before checking for duplicates to ensure consistency.

Suggested change
# Validate student is not already signed up
if email in activity["participants"]:
raise HTTPException(status_code=400, detail="Already signed up for this activity")
# Add student
activity["participants"].append(email)
return {"message": f"Signed up {email} for {activity_name}"}
# Normalize email to lowercase
normalized_email = email.lower()
# Validate student is not already signed up
if normalized_email in activity["participants"]:
raise HTTPException(status_code=400, detail="Already signed up for this activity")
# Add student
activity["participants"].append(normalized_email)
return {"message": f"Signed up {normalized_email} for {activity_name}"}

Copilot uses AI. Check for mistakes.
@BIPLAVGHOSAL BIPLAVGHOSAL merged commit d15d434 into main May 10, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants